﻿@model KRM.Core.vLoadPlanningOrderItem
@{
    ViewBag.Title = "Move Carrier";
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
}
<script>
    $(document).ready(function () {
        $(".cbcheckdate").change(function () {
            if ($(this).is(":checked")) {
                $(".DespatchDate").removeAttr("disabled");
            } else {
                $(".DespatchDate").attr("disabled", "disabled");
            }
        });
    });
    function carrierchange(carrierid) {
        $.ajax({
            url: "/load/movecarrierchange?carrierid=" + carrierid,
            success: function (data) {
                $("#CarrierServiceID").html("");
                $.each(data, function (id, option) {
                    $("#CarrierServiceID").append($('<option></option>').val(option.id).html(option.name));
                });
            }
        });
    }
</script>
<div style="padding: 10px">
    @Html.Partial("Partial/_MessageResult")
    <form action="/load/movecarrier" method="POST" class="margin0">
        <input type="hidden" name="oldWarehouseid" value="@Model.WarehouseID"/>
        <input type="hidden" name="oldcarrierid" value="@Model.carrierID"/>
        <input type="hidden" name="orderitemid" value="@Model.OrderItemID"/>
        <fieldset>
            <legend>Move warehouses</legend>
            <div class="row-fluid">
                <div class="span3"></div>
                <div class="span8">
                    @Html.DropDownList("WarehouseID", null, new { @class = "input-block-level" })
                </div>
            </div>
        </fieldset>
        <fieldset>
            <legend>New carrier service</legend>
            <div class="row-fluid">
                <div class="span3">Carrier</div>
                <div class="span8">
                    @Html.DropDownList("CarrierID", null, new { @class = "input-block-level", onchange = "carrierchange(this.value)" })
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">Service</div>
                <div class="span8">
                    @Html.DropDownList("CarrierServiceID", null, new { @class = "input-block-level" })
                </div>
            </div>
        </fieldset>
        <fieldset>
            <legend>Move to Hub</legend>
            <div class="row-fluid">
                <div class="span3">Despatch Date</div>
                <div class="span8">
                    <label>
                        <input type="checkbox" class="cbcheck cbcheckdate" name="DespatchDatecheck" />
                        <div class="input-append datetimepicker">
                            <input data-format="dd/MM/yyyy" type="text" name="DespatchDate" class="DespatchDate" disabled="disabled" required="required">
                            <span class="add-on">
                                <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                            </span>
                        </div>
                    </label>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3"></div>
                <div class="span8">
                    <label>
                        <input type="checkbox" class="cbcheck" name="emailCustomersPrepare" />
                        Email prepare for Despatch to Hub</label>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3"></div>
                <div class="span8">
                    <label>
                        <input type="checkbox" class="cbcheck" name="emailcustomer" />
                        Email Despatch To Hub</label>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3"></div>
                <div class="span8">
                    <label>
                        <input type="checkbox" class="cbcheck" name="CreateDeliveryDocuments" />
                        Create labels && delivery manifest</label>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3"></div>
                <div class="span8">
                    <label>
                        <input type="checkbox" class="cbcheck" name="CreatePackingLabel" />
                        Create packing labels</label>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3"></div>
                <div class="span8">
                    <label>
                        <input type="checkbox" class="cbcheck" name="CreatePackingList" />
                        Create packing list</label>
                </div>
            </div>
        </fieldset>
        <p>Order items</p>
        <div class="row-fluid" style="overflow: auto">
            <table class="table table-bordered table-fix">
                <thead>
                    <tr>
                        <th>DeliveryDate</th>
                        <th>OrderRef</th>
                        <th>PostCode</th>
                        <th>Product</th>
                        <th>Qty</th>
                        <th>Special Instructions</th>
                        <th>Weight</th>
                        <th>Packages</th>
                        <th>Customer</th>
                        <th>Address</th>
                        <th>Email</th>
                        <th>DatePlaced</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>@Model.DeliveryDate</td>
                        <td>@Model.OrderRef</td>
                        <td>@Model.Postcode</td>
                        <td>@Model.Product</td>
                        <td>@Model.Qty</td>
                        <td>@Model.SpecialInstructions</td>
                        <td>@Model.WeightKG</td>
                        <td>@Model.Packages</td>
                        <td>@Model.Customer</td>
                        <td>@Model.Address</td>
                        <td>@Model.EmailAddress</td>
                        <td>@Model.DatePlaced</td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="row-fluid text-right" style="margin-top: 15px">
            <input type="submit" class="btn btn-primary w90" value="Move" style="width: 90px" />
            <input type="button" onclick="window.close()" class="btn" style="width: 90px" value="Close" />
        </div>
    </form>
</div>
